﻿
Namespace Aricie.DNN.Modules.LuceneSearch.Filtering
    Public Class FilterRule

        Public Property Label As String

        Public Property MatchingType As Type

        Public Property InnerVerification As Func(Of Lucene.Net.Search.BooleanQuery, Boolean)

        Public Function Matches(q As Lucene.Net.Search.Query) As Boolean
            If (q.GetType().Equals(MatchingType)) Then
                If (InnerVerification IsNot Nothing) Then
                    Return InnerVerification.Invoke(DirectCast(q, Lucene.Net.Search.BooleanQuery))
                End If
                Return True
            End If
            Return False
        End Function
    End Class


End Namespace